// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import  VueResource from 'vue-resource'
import axios from 'axios'
import {sha256} from "js-sha256";
import {file2base} from './assets/js/common'
import Amap from 'vue-amap'
var moment = require('moment')
import VCharts from 'v-charts'
Vue.use(VCharts)
// import {lazyAMapApiLoaderInstance} from "vue-amap";
moment().format();
Vue.use(Amap);
Amap.initAMapApiLoader({
  key:'84bbfeeafc393d198c1174025bb7f29e',
  uiVersion: '1.0',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
});
// lazyAMapApiLoaderInstance.load().then(()=>{
//   this.map = new AMap.Map('amapContainer', {
//     center: new AMap.LngLat(121.59996, 31.197646)
//   });
// })
Vue.prototype.$sha256 = sha256;
Vue.prototype.axios = axios;
Vue.config.productionTip = false;
Vue.use(ElementUI);
Vue.use(VueResource);
Vue.prototype.file2base = file2base;
// 监听事件
Vue.prototype.resetSetItem = function (key, newVal) {
  // 创建一个StorageEvent事件
  var newStorageEvent = document.createEvent('StorageEvent');
  const storage = {
    setItem: function (k, val) {
      sessionStorage.setItem(k, val);
      // 初始化创建的事件
      newStorageEvent.initStorageEvent('setItem', false, false, k, null, val, null, null);
      // 派发对象
      window.dispatchEvent(newStorageEvent)
    }
  };
  return storage.setItem(key, newVal);
};
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  render:h=>h(App)
});
